package com.company.www.exception;

import com.company.www.common.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler(ServiceException.class)
    public ResponseResult handlerServiceException(ServiceException e) {
        return ResponseResult.error(e.getMessage());
    }

    @ExceptionHandler(RuntimeException.class)
    public ResponseResult handlerRuntimeException(RuntimeException e) {
        return ResponseResult.error(e.getMessage());
    }
}
